<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class HoardingInstruction extends Model
{
    protected $table='hoarding_instructions';
    protected $guarded=[];
    public $timestamps=false;

    //新增或修改
    public static function addOrUpdate($id,$title,$description,$start_end_time){
        if(!$id){
            return HoardingInstruction::insert(['title'=>$title,'description'=>$description,'start_end_time'=>$start_end_time]);
        }else{
            return HoardingInstruction::where(['id'=>$id])->update(['title'=>$title,'description'=>$description,'start_end_time'=>$start_end_time]);
        }

    }

    //查询
    public static function store($id){
        return HoardingInstruction::find($id);
    }
}
